package tool.image;

import java.awt.Color;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;

import javax.imageio.ImageIO;

import org.w3c.dom.css.CSSPrimitiveValue;
import org.w3c.dom.css.RGBColor;

public class ColorTool {

	public static void main(String args[]) throws IOException {
		BufferedImage bi  = ImageIO.read(new File(System.getProperty("user.dir") + "/img2/1.png"));
		BufferedImage right  = new BufferedImage(bi.getWidth(), bi.getHeight(), BufferedImage.TYPE_INT_ARGB);
		for(int y=0;y<bi.getHeight();y++) {
			for(int x=0;x<bi.getWidth();x++) {
				bi.getRGB(x, y);
				int rgb = bi.getRGB(x, y);
				Color mycolor = new Color(rgb);
				if(mycolor.getRed()>120) {

					right.setRGB(x, y, rgb);
				}
			}
		}
		ImageIO.write(right, "png", new File(System.getProperty("user.dir") + "/img2/1_.png"));
	}
	
}
